﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MallInteractiveMap.Language;

namespace MallInteractiveMap.CMSWebClient.Common
{
    public partial class MIMToolbar : System.Web.UI.UserControl
    {
        public event EventHandler Edit_Click;
        public event EventHandler Delete_Click;
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        protected void EditLink_Click(object sender, EventArgs e)
        {
            if(Edit_Click != null)
            {
                Edit_Click(sender, e);
            }
        }
        protected void DeleteLink_Click(object sender, EventArgs e)
        {
            if (Delete_Click != null)
            {
                Delete_Click(sender, e);
            }
        }
        [Browsable(true)]
        public string NewButtonLink
        {
            set
            {
                New.NavigateUrl = value;
            }
        }

        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            SetLanuageAndResources();
        }

        private void SetLanuageAndResources()
        {
            New.Text = LanguageLoader.GetText("NEW");
            Edit.Text = LanguageLoader.GetText("EDIT");
            Delete.Text = LanguageLoader.GetText("DELETE");
        }
        [Browsable(true)]
        public bool IsNewVisible
        {
            set { New.Visible = value; }
        }
        [Browsable(true)]
        public bool IsEditVisible
        {
            set { Edit.Visible = value; }
        }
        [Browsable(true)]
        public bool IsDeleteVisible
        {
            set { Delete.Visible = value; }
        }
    }
}